<?php
include 'dbconfig.php'; 
mysql_select_db($db, $con);


$name    = $_POST[0];
$area1   = $_POST[1];
$area2   = $_POST[2];
$comp    = $_POST[3];
$ects    = $_POST[4];
$teacher = $_POST[5];
$key     = $_POST[6];
$term    = $_POST[7];
$year    = $_POST[8];
$sem     = $_POST[9];
$cid     = $_POST['hash'];

$hash = md5($cid.$year.$term);
$query2 = "INSERT INTO course_instances VALUES (0, '$hash', '$cid', $year, $term, '$key', '$teacher')";
mysql_query($query2);

echo $cid;

mysql_close($con);

?>